﻿using System.Collections.Generic;
using System.Web;
using Dexter.Web.Mvc.ViewModel.ViewsData;

namespace Dexter.PluginManager {
	public class RenderPluginManager : IRenderPluginManager {
		readonly IPluginManager pluginManager;

		/// <summary>
		/// 	Initializes a new instance of the <see cref="T:System.Object" /> class.
		/// </summary>
		public RenderPluginManager(IPluginManager pluginManager) {
			this.pluginManager = pluginManager;
		}

		#region IRenderPluginManager Members

		public void ActionExecuted(HttpContextBase context, PublicBaseViewData baseViewData) {
			IEnumerable<IPlugin> plugins = pluginManager.GetRenderPlugins();

			foreach (IPlugin renderPlugin in plugins) {
				renderPlugin.ChangeModel(context, baseViewData);
			}
		}

		#endregion
	}
}